﻿@*
    TicketDesk - Attribution notice
    Contributor(s):

         Stephen Redd (stephen@reddnet.net, http://www.reddnet.net)

    This file is distributed under the terms of the Microsoft Public
    License (Ms-PL). See http://opensource.org/licenses/MS-PL
    for the complete terms of use.

    For any distribution that contains code from this file, this notice of
    attribution must remain intact, and a copy of the license must be
    provided to the recipient.
*@

@using TicketDesk.Domain
@using TicketDesk.Domain.Model
@model TicketDesk.Web.Client.Models.TicketEmail
Content-Type: text/html; charset=utf-8

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Ticket #@Model.Ticket.TicketId </title>
    <style type="text/css">
        * {
            font-family: Calibri, Tahoma, Verdana, Helvetica, Sans-Serif;
            font-size: 10pt;
        }

        p {
            margin: 0.8ex 0 0.8ex 0;
        }

        td {
            padding-left: 3px;
            padding-right: 3px;
        }

        .tag {
            border: 1px solid #dcdcdc;
            background-color: #fcf8e3;
            font-size: 9pt;
            padding: 2px;
        }

        dl {
            margin-left: 15px;
        }

        dd {
            text-indent: 1em;
            font-family: monospace;
            font-size: smaller;
        }
    </style>
</head>
<body>
    <div style="border: 1px solid #dcdcdc;">
        <table style="background-color: #B3CBDF;width: 100%;">
            <tr>
                <td style="width: 55px; font-weight: bold; border-right: 1px solid #dcdcdc; text-align: center;" rowspan="2">
                    <a href="@((Model.SiteRootUrl??string.Empty).TrimEnd('/'))@Url.Action("Index", "Ticket", new {Id = Model.Ticket.TicketId })">
                        @Model.Ticket.TicketStatus.GetDescription()
                    </a>
                </td>
                <td style="width: 40px; font-weight: bold; border-right: 1px solid #dcdcdc; text-align: center;" rowspan="2">
                    <a href="@((Model.SiteRootUrl??string.Empty).TrimEnd('/'))@Url.Action("Index", "Ticket", new {Id = Model.Ticket.TicketId })">
                        #@Model.Ticket.TicketId
                    </a>

                </td>
            </tr>
            <tr>
                <td colspan="2" style="font-weight: bold;">
                    <a href="@((Model.SiteRootUrl??string.Empty).TrimEnd('/'))@Url.Action("Index", "Ticket", new {Id = Model.Ticket.TicketId })">
                        @Model.Ticket.Title
                    </a>
                </td>

            </tr>
        </table>
        <table style="border-bottom: 1px solid #e7e7e7; width: 100%; background-color: #F7F7F7;">
            @if (!string.IsNullOrEmpty(Model.Ticket.TagList))
            {
                <tr>
                    <td style="text-align: right;">

                        @foreach (var tag in Model.Ticket.TagList.Split(','))
                        {
                            <span class="tag">@tag</span>
                        }

                    </td>
                </tr>
            }
            <tr>
                <td>
                    @Model.Ticket.Priority Priority @Model.Ticket.Category @Model.Ticket.TicketType
                </td>
            </tr>
            @if (Model.IsMultiProject)
            {
                <tr>
                    <td>
                        Project: @Model.Ticket.Project.ProjectName
                    </td>
                </tr>
            }
            <tr>
                <td>
                    @if (string.IsNullOrEmpty(Model.Ticket.AssignedTo))
                    {
                        @:Assigned To: <span class="tag">Unassigned</span>
                }
                    else
                    {
                        @:Assigned To: @Model.Ticket.GetAssignedToInfo().DisplayName
                }
                </td>
            <tr>
                <td>
                    Owner: @Model.Ticket.GetOwnerInfo().DisplayName
                </td>
            </tr>
            <tr>
                <td>
                    Updated by: @Model.Ticket.GetLastUpdatedByInfo().DisplayName at @Model.Ticket.LastUpdateDate.DateTime.ToShortDateString() @Model.Ticket.LastUpdateDate.DateTime.ToShortTimeString()

                </td>
            </tr>
        </table>

        <table style="width: 100%;">
            <tr>
                <td style="">
                    <div style="overflow-y:scroll; max-height: 250px; min-height: 100px;">
                        @Model.Ticket.HtmlDetails()
                    </div>
                </td>
            </tr>
        </table>
        <table style="background-color: #B3CBDF; width: 100%;">
            <tr>
                <td style="font-weight: bold;">
                    Activity
                </td>
            </tr>
        </table>
        <div style="padding: 10px;">
            @foreach (var evt in Model.Ticket.TicketEvents.OrderByDescending(c => c.EventDate))
            {
                <div style="border: 1px solid #dfdfdf; margin-bottom: 10px;">
                    <table style="background-color: #F7F7F7;width: 100%;">
                        <tr>
                            <td><strong>@evt.GetEventByInfo().DisplayName</strong> @evt.EventDescription</td>
                        </tr>
                        <tr>
                            <td style="text-indent: 1em; font-size: smaller">
                                @evt.EventDate.Date.ToLongDateString()
                                @evt.EventDate.Date.ToShortTimeString()
                            </td>
                        </tr>
                    </table>

                    @{
                        var cmt = evt.HtmlComment();
                        if (!string.IsNullOrEmpty(cmt.ToString()))
                        {
                            <table style="width: 100%;">
                                <tr>
                                    <td style="font-family: monospace; font-size: 9pt;">@cmt</td>
                                </tr>
                            </table>
                        }
                    }
                </div>
                        }
        </div>

    </div>
</body>
</html>
